//
//  ListDataModel.swift
//  codelabs
//
//  Created by 雷雷 on 23/05/2025.
//

import Foundation
import SwiftUI
import CoreLocation

/**
    Landmark data model for json parsal.
 */
struct Landmark:Hashable,Codable,Identifiable{

    var id:Int
    var name:String
    var park:String
    var state:String
    var description:String
    var isFavorite:Bool
    var isFeatured:Bool
    
    var category:Category
    
    enum Category:String,CaseIterable,Codable{
        
        case lakes="Lakes"
        case rivers="Rivers"
        case mountains="Mountains"
    }
    
    // Image name receive name str from json,
    // then provide image instance
    private var imageName:String
    
    
    // User read image that provide by imageName
    var image:Image{
        Image(imageName)
    }
    
    private var coordinates: Coordinates
       var locationCoordinate: CLLocationCoordinate2D {
           CLLocationCoordinate2D(
               latitude: coordinates.latitude,
               longitude: coordinates.longitude)
       }


       struct Coordinates: Hashable, Codable {
           var latitude: Double
           var longitude: Double
       }
}
